package com.ljfiction.book.tools;

import com.ljfiction.book.Baner.CreatBaocunBean;

/**
 * Created by Android on 2018/3/19.
 */

public class CreatChapterSettingManager {
    private volatile static CreatChapterSettingManager manager;

    public static CreatChapterSettingManager getInstance() {
        return manager != null ? manager : (manager = new CreatChapterSettingManager());
    }

    /*
    * 获取背景颜色所属坐标
    * */
    public int getCreatBeijingcolor() {
        return SharedPreferencesUtil.getInstance().getInt("creatbeijingcolor", 0);
    }

    /*
    * 保存背景颜色所属坐标
    * */
    public void saveCreatBeijingcolor(int position) {
        SharedPreferencesUtil.getInstance().putInt("creatbeijingcolor", position);
    }
    /*
    * isshangchuan:0是未上传，1是上传
    * */
public void saceIsShangchuan(String bookId,int isshangchuan){
    SharedPreferencesUtil.getInstance().putInt(bookId+"isshangchuan", isshangchuan);
}
public int getIsShangchuan(String bookId){
   return SharedPreferencesUtil.getInstance().getInt(bookId+"isshangchuan", 1);
}
    /*
   * 记录创作页面屏幕亮度
   * */
    public void saveCreatSeekPosition(int seekPosition) {
        SharedPreferencesUtil.getInstance().putInt("seekCreatPosition", seekPosition);
    }

    public int getCreatSeekposition() {
        return SharedPreferencesUtil.getInstance().getInt("seekCreatPosition", ScreenUtils.getScreenBrightness());
    }

    /*
   * 记录创作页面屏幕亮度
   * */
    public void saveCreatZitidaxiao(int zitiposition) {
        SharedPreferencesUtil.getInstance().putInt("zitiCreatPosition", zitiposition);
    }

    public int getCreatZitiSeekposition() {
        return SharedPreferencesUtil.getInstance().getInt("zitiCreatPosition", 0);
    }

    /*
* 记录创作页面是否为夜间模式
* */
    public void saveIsCreatNightDay(int isNight) {
        SharedPreferencesUtil.getInstance().putInt("isCreatNight", isNight);
    }

    public int getIsCreatNightDay() {
        return SharedPreferencesUtil.getInstance().getInt("isCreatNight", 0);
    }
/*
* 保存书籍的卷
*
* */

    public void saveBookvolumId(String bookid,int volumeId) {
        SharedPreferencesUtil.getInstance().putInt("volumeid"+bookid, volumeId);
    }

    public int getBookvolumId(String bookid) {
        return SharedPreferencesUtil.getInstance().getInt("volumeid"+bookid, 0);
    }

      /*
    * 自动存搞
    * bookid:书Id
    * isBaocun：是否已经上传服务器，0是未上传，1是已上传
    * isfromCaogao：是不是从草稿箱过来的，0是不是，1是是
    * bookWriterId：作者的Id
    * bookName：书名
    *chapterName:章节名字
    *chapterContext：章节内容
    *time：保存时的时间
    *volumeId：卷id
    *authorSay：作者的话
    * chapterId：章节id 从草稿箱过来是才有
    * */

    public  void saveCreatobject(String bookId, CreatBaocunBean creatBaocunBean) {
        SharedPreferencesUtil.getInstance().saveObject(bookId+"baocuncreat",creatBaocunBean);
    }
    public CreatBaocunBean getCreatObject(String  bookId){
        return  SharedPreferencesUtil.getInstance().getObject(bookId+"baocuncreat");
    }
}
